@echo off 
echo "build start"

:: set 32 bit or 64 bit
set build_type_64bit="YES"

::clear bin directory
set bindir="bin"
if not exist %bindir% (md  %bindir%) else (del %bindir% /a/s/q)

::create empty build directory
set builddir="build32"
if %build_type_64bit%=="NO" (set builddir="build32") else (set builddir="build64")
if not exist %builddir% (md  %builddir%) else (del %builddir% /a/s/q)

cd %builddir% 


if %build_type_64bit%=="NO" (
cmake.exe -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 15" ..
) else (
cmake.exe -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 15 Win64" ..
)

cd ..

:: compile solution
if not defined "%1"  (
set vs17Path="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community"
) else (
set vs17Path=%1
)

call %vs17Path%"\Common7\Tools\VsDevCmd.bat"

MSBuild %builddir%\INSTALL.vcxproj /t:Rebuild /p:Configuration=Release

xcopy /y /e conf %bindir%

echo "build license end"